/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package luft27.comm.dozor;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;

/**
 *
 * @author amalikov
 */
public class OperPoint implements MessagePayload {
	public float lat;
	public float lon;
	public short alt;
	public short radius;	

	@Override
	public byte[] get() {
		ByteBuffer bb = ByteBuffer.allocate(256).order(ByteOrder.LITTLE_ENDIAN);
		bb.putFloat(lat);
		bb.putFloat(lon);
		bb.putShort(alt);
		bb.putShort(radius);
		return Arrays.copyOf(bb.array(), bb.position());	
	}

	@Override
	public void set(byte[] data) {
		ByteBuffer bb = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN);
		lat = bb.getFloat();
		lon = bb.getFloat();
		alt = bb.getShort();
		radius = bb.getShort();
	}	
}
